@extends('admin.layouts.admin')
@section('header')
    <link href="{{ asset('/css/autocomplate.css') }}" rel="stylesheet" type="text/css">
    <style>
        .editormd-toolbar{
            position: absolute !important;
            width: 100% !important;
            left: 0px !important;
        }
        .task-list-item-checkbox{
            display: block;
        }
    </style>
@endsection
@section('content')
    <div class="layui-form" lay-filter="LAY-edit-forms" id="LAY-edit" style="padding: 20px 30px 0 0;">
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" lay-verify="required" value="{{$data->name}}" placeholder="名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">编码</label>
            <div class="layui-input-block">
                <input type="text" name="code" lay-verify="required" value="{{$data->code}}" placeholder="编码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最低期望</label>
            <div class="layui-input-block">
                <input type="text" name="expect_low" value="{{$data->expect_low}}" placeholder="￥" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最高期望</label>
            <div class="layui-input-block">
                <input type="text" name="expect_hight" value="{{$data->expect_hight}}" placeholder="￥" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-edit-forms" id="LAY-edit-forms" value="确认">
        </div>
    </div>

@endsection
@section('scripts')
    <script src="{{ asset('/js/jquery.min.js') }}"></script>
    <script src="{{ asset('/js/index/autocomplete.js') }}"></script>
    <script type="text/javascript">
        var countries = [];
        $.ajax({
            type : 'get',
            url :  '/get_stock_all',
            dataType : "json",//json格式
            async : false,
            success : function(obj) {//成功后拿到的data
                var data = obj.data

                //循环放在对象
                for(var i=0;i<data.length;i++) {
                    var person = {};
                    person.value = data[i].stock_name + '/'  + data[i].stock_number;
                    person.data= data[i].stock_number;
                    countries.push(person);
                }
            }
        });
        $('#stock').autocomplete({
            lookup: countries,
            onSelect: function (suggestion) {
                //console.log($("#qaTags").val());
                //点击触发调用
            }
        });
    </script>
    <script>
        layui.config({
            base: '../' //静态资源所在路径
        }).use([ 'table', 'form'], function(){
            var $ = layui.$
                ,form = layui.form
            form.render('checkbox');


        });//use

    </script>
@stop
